<?
class Feeder
{
    function send()
    {
        $feedingArray = array();
         
        
        $config = array(
//            array('module'=>'page', 'model'=>'Page'),
            array('module'=>'news', 'model'=>'News'),
        );
        
        
        foreach ($config as $part)
        {
            Loader::includeModuleModels($part['module']);
            $DAO  = new $part['model']();
            $feed = $DAO->getRssFeed();
            $feedingArray = array_merge($feed, $feedingArray);
        }
        
        
        
        
        
        $link        = "http://google.com";Zend_Controller_Front::getInstance()->getBaseUrl();
        $description = Zend_Registry::get('config')->rss->description;
        $title       = Zend_Registry::get('config')->rss->title;

        $feedArray = array(
            'title'       => $title,
            'link'        => $link,
            'description' => $description,
            'charset'     => 'UTF-8',
            'entries'     => array()
        );

        foreach ($feedingArray as $item) {
            $date = new Zend_Date($item['date'], 'YYYY-MM-dd HH:mm:ss');
            $itemTimestamp = $date->getTimestamp();

            $feedArray['entries'][] = array(
                'title'       => $item['title'],
                'link'        => $item['link'],
                'description' => $item['text'],
                'lastUpdate'  => $itemTimestamp
            );

        }

        $feed = Zend_Feed::importArray($feedArray, 'rss');
        $feed->send();
    }
}